{% extends 'index.html' %}

{% block body %}
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
        <td class= "report-header" colspan="2"><h3><img src= "gui/movimenti_magazzino48x48.png"> Registro: <strong>{{dao.registro_numerazione}}</strong></h3></td>
                <td class="report-header" colspan="2"><h3>Numero: <strong>{{dao.numero}}</strong> /
                <strong>{{dao.parte|nonone}}</strong></h3></td>
            </tr>
    </table>

    <table cellpadding="0" cellspacing="0" border="0">
            <tr><td colspan="4" class="table-header">Dati movimento</td></tr>
            <tr>
                <td width="140px" class="odd-detail">Operazione</td>
                <td class="odd-detail"><strong>{{dao.operazione}}</strong></td>
            </tr>
        <tr>
            <td class="even-detail">Data movimento</td>
                <td class="even-detail">
                    {% if dao.data_movimento %}
                        <strong>{{utils.dateTimeToString(dao.data_movimento)}}</strong>
                    {% endif %}
                </td>
    </tr>
            {% if dao.id_cliente %}
            <tr >
                <td class="odd-detail">Cliente</td>
                <td class="odd-detail">
                    {% if dao.ragione_sociale_cliente %}
                        <strong>{{dao.ragione_sociale_cliente}}
            </strong>
                {% endif %}</td>
            </tr>
            {% else %}
            <tr >
                <td class="odd-detail">Fornitore</td>
                <td class="odd-detail">
                    {%  if dao.ragione_sociale_fornitore %}
                    <strong >{{dao.ragione_sociale_fornitore}}

                    </strong>
                {% endif %}
                </td>
            </tr>
            {% endif %}
            <tr>
                <td class="even-detail">Note interne</td>
                <td class="even-detail"><strong>{{dao.note_interne}}</strong></td>
            </tr>
        </table>

        <table cellpadding="0" cellspacing="4" border="0">
        <tr><td colspan="9" class="table-header">Righe movimento</td></tr>
        <tr>
            <td class="even-detail">Magazzino</td>
            <td class="even-detail">Articolo</td>
            <td class="even-number">Iva (%)</td>
            <td class="even-number">Quantita'</td>
            <td class="even-number">Prezzo netto</td>
            <td class="even-number">Totale</td>
        </tr>
        {% for riga in dao.righe %}
        <tr >
            {% if riga.id_magazzino %}
            <td width="16%" class="odd-detail" >{{riga.magazzino}}</td>
            {% else %}
            <td width="16%" class="odd-detail"></td>
            {% endif %}
            <td width="40%" class="odd-detail">{{riga.descrizione}}</td>
            <td width="10%" class="odd-number">{{utils.number_format() % riga.percentuale_iva}}</td>
            <td width="12%" class="odd-number">{{utils.number_format() % ( riga.quantita * riga.moltiplicatore)}}</td>
            <td width="12%" class="odd-number">{{utils.number_format() % riga.valore_unitario_netto}}</td>
            <td width="10%" class="odd-number"><strong>{{utils.number_format() % ( riga.quantita * riga.moltiplicatore * riga.valore_unitario_netto )}}</strong></td>
        </tr>
        {% endfor %}
        </table>
{% endblock %}
